package cn.isjinhao.crws.sql.grammar.retrieve.represention.group;

import cn.isjinhao.crws.sql.grammar.CurdStatement;
import cn.isjinhao.crws.sql.grammar.CurdStatementVisitor;
import cn.isjinhao.crws.sql.lexical.token.Token;
import java.util.List;

/**
 * @author 01395265
 * @description TODO
 * @date 2021/3/3
 */
public class GroupBySeg extends CurdStatement {

    private List<Token> columnList;

    private CurdStatement having;

    public GroupBySeg(List<Token> columnList, CurdStatement having) {
        this.columnList = columnList;
        this.having = having;
    }

    public GroupBySeg(List<Token> columnList) {
        this.columnList = columnList;
        this.having = null;
    }

    @Override
    public <R> R accept(CurdStatementVisitor<R> curdStatementVisitor) {
        return curdStatementVisitor.visitGroupBySeg(this);
    }

    public List<Token> getColumnList() {
        return columnList;
    }

    public CurdStatement getHaving() {
        return having;
    }
}
